package graphics;

import java.awt.Color;

import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.GeneralPath;
import java.awt.image.BufferedImage;

public class MaxGraphics {
	private Graphics2D g;
	
	public Graphics2D getGraphics() {
		return g;
	}
	
	public MaxGraphics(Graphics2D g) {
		this.g = g;
	}
	
	public void drawText(double x, double y, String s) {
		g.drawString(s, (int) x, (int) y);
	}
	
	public void drawRect(double x, double y, double length, double width) {
		g.drawRect((int) (x-(width/2)), (int) (y-(length/2)), (int) width, (int) length);
	}
	
	public void drawRectUL(double x, double y, double length, double width) {
		g.drawRect((int) (x), (int) (y), (int) width, (int) length);
	}
	
	public void drawOval(double x, double y, double xr, double yr) {
		g.drawOval((int) (x - xr), (int) (y - yr), (int) (xr*2), (int) (yr*2));
	}
	
	public void drawLine(double x1, double y1, double x2, double y2) {
		g.drawLine((int) x1, (int) y1, (int) x2, (int) y2);
	}
	
	public void drawPolygon(Polygon p) {
		g.drawPolygon(p);
	}
	
	public void fillRect(double x, double y, double length, double width) {
		g.fillRect((int) (x-(width/2)), (int) (y-(length/2)), (int) length, (int) width);
	}
	
	public void fillRectUL(double x, double y, double length, double width) {
		g.fillRect((int) x, (int) y, (int) length, (int) width);
	}
	
	public void fillOval(double x, double y, double xr, double yr) {
		g.fillOval((int) (x - xr), (int) (y - yr), (int) (xr*2), (int) (yr*2));
	}
	
	public void rotate(double angle) {
		g.rotate(angle);
	}
	
	public void setColor(Color c) {
		g.setColor(c);
	}
	
	public void fillPolygon(int[] xPoints, int[] yPoints, int numP) {
		g.fillPolygon(xPoints, yPoints, numP);
	}
	
	public void translate(double x, double y) {
		g.translate(x, y);
	}
	
	public void fillPolygon(Polygon p) {
		g.fillPolygon(p);
	}
	
	public void drawImage(BufferedImage image, double x, double y) {
		g.drawImage(image, (int) x, (int) y, null);
	}
	
	public void fillPath(GeneralPath p) {
		g.fill(p);
	}
	
	public Graphics2D getGrahpics() {
		return g;
	}
	
	public void drawShape(Shape s) {
		g.draw(s);
	}
	
	public void fillShape(Shape s) {
		g.fill(s);
	}
}
